<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户注册</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='login.css') }}">
</head>
<body>
    <div class="login-container">
        <h2>用户注册</h2>
    <form method="POST" action="{{ url_for('register') }}">
    {% if error %}
    <script>
        window.onload = function() {
            alert('{{ error }}');
        };
    </script>
    {% endif %}
        <div>
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required>
        </div>
        <div>
            <label for="password">密码:</label>
            <div class="password-wrapper">
                <input type="password" id="password" name="password" required>
            </div>
        </div>
        <script>
        function togglePasswordVisibility() {
            const passwordInput = document.getElementById('password');
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
            } else {
                passwordInput.type = 'password';
            }
        }
        </script>
        <div>
            <label for="invite_code">邀请码:</label>
            <input type="text" id="invite_code" name="invite_code" required>
        </div>
        <button type="submit">注册</button>
    </form>
        <p class="auth-links">已有账号？<a href="{{ url_for('login') }}">立即登录</a></p>
    </div>
</body>
</html>